home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / printing / lblprnt / lblprnt.cls
Encoding:
Text File  |  1996-01-01  |  1.3 KB  |  66 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "PrintedLabel"
  6. Attribute VB_Creatable = False
  7. Attribute VB_Exposed = False
  8. Option Explicit
  9. Public lblX%
  10. Public lblY%
  11. Public lblCaption$
  12. 'Refinements on this welcome and please let me know about
  13. 'them at 102251,3060@compuserve.com.
  14.  
  15.  
  16.  
  17. Public Static Property Get X()
  18.     X = lblX
  19. End Property
  20.  
  21. Public Static Property Let X(vNewValue)
  22.     lblX = vNewValue
  23. End Property
  24.  
  25. Public Static Property Get Y()
  26.     Y = lblY
  27. End Property
  28.  
  29. Public Static Property Let Y(vNewValue)
  30.     lblY = vNewValue
  31. End Property
  32.  
  33. Public Static Property Get Caption()
  34.     Caption = lblCaption
  35. End Property
  36.  
  37. Public Static Property Let Caption(vNewValue)
  38.     lblCaption = vNewValue
  39. End Property
  40.  
  41. Private Sub Class_Initialize()
  42. lblNum = lblNum + 1 'Counter for label number
  43. lblX = 0
  44. lblY = 0
  45. lblCaption = "Label" & lblNum
  46. End Sub
  47.  
  48.  
  49.  
  50. Public Function PrintLabel(DestFrm As Form) As Boolean
  51. Attribute PrintLabel.VB_Description = "Prints text on the form like a label."
  52. On Error GoTo PLClsErr
  53.  
  54. DestFrm.CurrentX = lblX
  55. DestFrm.CurrentY = lblY
  56. DestFrm.Print lblCaption
  57. PrintLabel = True
  58. Exit Function
  59.  
  60. PLClsErr:
  61.     MsgBox Err.Description
  62.     PrintLabel = False
  63.     Exit Function
  64.     
  65. End Function
  66.